//
// Created by wze-zero on 2024/9/17 017.
//
#include <iostream>

using namespace std;

int main() {
    int n, num;
    bool check = true;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cin >> num;
            if (i > j && num != 0) {
                check = false;
            }
        }
    }
    check ? cout << "YES" << endl : cout << "NO" << endl;
    return 0;
}